//
//  AboutViewController.m
//  YSSmartHome
//
//  Created by yanghao on 2016/10/8.
//  Copyright © 2016年 yahaong. All rights reserved.
//

#import "AboutViewController.h"
#import "YHMarcros.h"

@interface AboutViewController ()

@property (nonatomic, strong)UIImageView *logoView;
@property (nonatomic, strong)UILabel *contentLabel;
@property (nonatomic, strong)UILabel *iflyLabel;
@property (nonatomic, strong)UILabel *versionLabel;
@end

@implementation AboutViewController

#pragma mark - life
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"关于宇数";
    [self.view addSubview:self.logoView];
    [self.logoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.equalTo(kIphoneSize_Height(80));
        make.width.equalTo(kIphoneSize_Widith(108));
        make.height.equalTo(kIphoneSize_Widith(108));
    }];
    [self.view addSubview:self.contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.logoView.bottom).offset(kIphoneSize_Height(20));
        make.centerX.equalTo(self.logoView);
        make.leading.equalTo(self.view.leading).offset(kIphoneSize_Widith(30));
        make.trailing.equalTo(self.view.trailing).offset(kIphoneSize_Widith(-30));
        
    }];
    [self.view addSubview:self.iflyLabel];
    [self.iflyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-5);
        make.leading.equalTo(self.view).offset(5);
    }];
    [self.view addSubview:self.versionLabel];
    [self.versionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view).offset(-5);
        make.trailing.equalTo(self.view).offset(-5);
    }];
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - lazy loading
- (UIImageView *)logoView
{
    if (!_logoView)
    {
        _logoView = [[UIImageView alloc]init];
        _logoView.image = [UIImage imageNamed:@"me_about_logo"];
    }
    return _logoView;
}
- (UILabel *)contentLabel
{
    if (!_contentLabel)
    {
        _contentLabel = [[UILabel alloc]init];
        _contentLabel.textColor = RGBColor(102, 102, 102);
        _contentLabel.font = [UIFont systemFontOfSize:15];
        _contentLabel.numberOfLines = 0;
        _contentLabel.text = @"\"宇数智能家居\"是宇数科技公司下知名智能家居品牌。\n宇数科技成立于2017年，总部位于中国成都。\n公司集自主研发、生产、销售和服务于一体，掌握核心关键技术，获得国内外近百项专利，是世界500强企业指定的产品及解决方案提供商。";
        NSMutableAttributedString*text = [[NSMutableAttributedString alloc]initWithString:_contentLabel.text];
        NSMutableParagraphStyle*style = [[NSMutableParagraphStyle alloc]init];
        style.firstLineHeadIndent = 30;
        style.lineSpacing = 8;//行距
        //需要设置的范围
        NSRange range =NSMakeRange(0, _contentLabel.text.length);
        [text addAttribute:NSParagraphStyleAttributeName value:style range:range];
        _contentLabel.attributedText= text;
    }
    return _contentLabel;
}

- (UILabel *)iflyLabel
{
    if (!_iflyLabel) {
        _iflyLabel = [[UILabel alloc]init];
        _iflyLabel.text = @"语言技术由科大讯飞提供";
        _iflyLabel.textColor = RGBColor(102, 102, 102);
        _iflyLabel.font = [UIFont systemFontOfSize:11];
    }
    return _iflyLabel;

}
- (UILabel *)versionLabel
{
    if (!_versionLabel) {
        _versionLabel = [[UILabel alloc]init];
        _versionLabel.text = @"软件版本:V4.0.1";
        _versionLabel.textColor = RGBColor(102, 102, 102);
        _versionLabel.font = [UIFont systemFontOfSize:13];
    }
    return _versionLabel;
    
}
@end
